package String;

/**
 * @author wuhan
 * @date 2019/9/24 10:10
 */
public class StringBufferDemo {
    public static void main(String[] args) {
        StringBuffer sb=new StringBuffer();
        sb.append("sadsad").append(true).append(34);
        sb.insert(0,2);
        sb.insert(1,3);
        sb.delete(0,1);
        sb.delete(0,sb.length());
        sb.append("23453321");
        sb.deleteCharAt(1);
        sb.replace(1,4,"java");
        sb.setCharAt(2,'2');
        sb.reverse();
        char [] chars =new char[4];
        sb.getChars(1,4,chars,1);
        for (int i = 0; i < 4; i++) {
            System.out.println( i+"   "+ chars[i]);
        }
        System.out.println(sb.toString());
    }
}
